package com.zwj.enums;

import com.zwj.vo.EnumResult;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public enum WorkInfoEnum {
    DAILY("0","日常作业"),PHASED("1","阶段性交付作业"),LAST("2","最终交付作业");

    private String key;
    private String value;
    WorkInfoEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }
    public static String getEnumValue(String key) {
        ValidEnum[] validEnums = ValidEnum.values();
        for (ValidEnum validEnum : validEnums) {
            if (validEnum.getKey().equals(key)) {
                return validEnum.getValue();
            }
        }
        return null;
    }
    public static List<EnumResult> getEnumList() {
        ValidEnum[] validEnums = ValidEnum.values();
        List<EnumResult> result = Stream.of(validEnums).map(
                entry -> new EnumResult(entry.getKey(), entry.getValue())).collect(Collectors.toList());
        return result;
    }
    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}

